package cn.coco.jf.fw.api.config;

import com.jfinal.config.Plugins;
import com.jfinal.plugin.cron4j.Cron4jPlugin;

public abstract class JkbatchConfig extends JkapiConfig{

    @Override
    public void configPlugin(Plugins me) {
        super.configPlugin(me);

        // 定时任务处理
        crons = new Cron4jPlugin();

        task();

        me.add(crons);

    }

   
    private Cron4jPlugin crons;
    
    public abstract void task();

    /**
     * 添加定时任务
     * @param cron
     * @param task
     */
    protected void addTask(String cron, Runnable task){
        crons.addTask(cron, task);
    }


}
    